package com.huaxin.hxmoduleworkorder.event;

import com.huaxin.hxmoduleworkorder.common.enums.MaintenanceOrderOperation;
import com.huaxin.hxmoduleworkorder.common.enums.MaintenanceOrderOperatorRole;
import com.huaxin.hxmoduleworkorder.common.enums.MaintenanceOrderStatus;

import java.time.Instant;

public final class MaintenanceOrderStatusChangedEvent {
    private final String orderId;
    private final MaintenanceOrderOperation action;
    private final MaintenanceOrderOperatorRole operatorRole;
    private final String operatorId;
    private final MaintenanceOrderStatus oldStatus;
    private final MaintenanceOrderStatus newStatus;
    private final Instant timestamp;

    // 私有构造，仅允许通过静态工厂创建
    private MaintenanceOrderStatusChangedEvent(String orderId,
                                               MaintenanceOrderOperation action,
                                               MaintenanceOrderOperatorRole operatorRole,
                                               String operatorId,
                                               MaintenanceOrderStatus oldStatus,
                                               MaintenanceOrderStatus newStatus,
                                               Instant timestamp) {
        this.orderId = orderId;
        this.action = action;
        this.operatorRole = operatorRole;
        this.operatorId = operatorId;
        this.oldStatus = oldStatus;
        this.newStatus = newStatus;
        this.timestamp = timestamp;
    }

    // ---------------- Getter ----------------

    public String getOrderId() {
        return orderId;
    }

    public MaintenanceOrderOperation getAction() {
        return action;
    }

    public MaintenanceOrderOperatorRole getOperatorRole() {
        return operatorRole;
    }

    public String getOperatorId() {
        return operatorId;
    }

    public MaintenanceOrderStatus getOldStatus() {
        return oldStatus;
    }

    public MaintenanceOrderStatus getNewStatus() {
        return newStatus;
    }

    public Instant getTimestamp() {
        return timestamp;
    }
}
